import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 设备保养分类信息 */
export interface EquipmentKeepType {
  id: number // id
  name?: string // 分类名称
  status: number // 状态
  description?: string // 描述
}

// 设备保养分类 API
export const EquipmentKeepTypeApi = {
  // 查询设备保养分类分页
  getEquipmentKeepTypePage: async (params: any) => {
    return await request.get({ url: `/business/equipment-keep-type/page`, params })
  },

  // 查询已启用的所有保养分类
  getEquipmentKeepTypeList: async () => {
    return await request.get({ url: `/business/equipment-keep-type/list` })
  },

  // 查询所有保养分类
  getEquipmentKeepTypeListNew: async () => {
    return await request.get({ url: `/business/equipment-keep-type/listNew` })
  },

  // 查询设备保养分类详情
  getEquipmentKeepType: async (id: number) => {
    return await request.get({ url: `/business/equipment-keep-type/get?id=` + id })
  },

  // 新增设备保养分类
  createEquipmentKeepType: async (data: EquipmentKeepType) => {
    return await request.post({ url: `/business/equipment-keep-type/create`, data })
  },

  // 修改设备保养分类
  updateEquipmentKeepType: async (data: EquipmentKeepType) => {
    return await request.put({ url: `/business/equipment-keep-type/update`, data })
  },

  // 删除设备保养分类
  deleteEquipmentKeepType: async (id: number) => {
    return await request.delete({ url: `/business/equipment-keep-type/delete?id=` + id })
  },

  /** 批量删除设备保养分类 */
  deleteEquipmentKeepTypeList: async (ids: number[]) => {
    return await request.delete({
      url: `/business/equipment-keep-type/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出设备保养分类 Excel
  exportEquipmentKeepType: async (params) => {
    return await request.download({ url: `/business/equipment-keep-type/export-excel`, params })
  },

  // 下载导入模板
  importTemplate: async () => {
    return request.download({ url: '/business/equipment-keep-type/get-import-template' })
  },

  // 查询设备保养分类分页
  getEquipmentKeepTypePageDamage: async (params: any) => {
    return await request.get({ url: `/Damage/equipment-keep-type/page`, params })
  },

  // 查询已启用的所有保养分类
  getEquipmentKeepTypeListDamage: async () => {
    return await request.get({ url: `/Damage/equipment-keep-type/list` })
  },

  // 查询所有保养分类
  getEquipmentKeepTypeListNewDamage: async () => {
    return await request.get({ url: `/Damage/equipment-keep-type/listNew` })
  },

  // 查询设备保养分类详情
  getEquipmentKeepTypeDamage: async (id: number) => {
    return await request.get({ url: `/Damage/equipment-keep-type/get?id=` + id })
  },

  // 新增设备保养分类
  createEquipmentKeepTypeDamage: async (data: EquipmentKeepType) => {
    return await request.post({ url: `/Damage/equipment-keep-type/create`, data })
  },

  // 修改设备保养分类
  updateEquipmentKeepTypeDamage: async (data: EquipmentKeepType) => {
    return await request.put({ url: `/Damage/equipment-keep-type/update`, data })
  },

  // 删除设备保养分类
  deleteEquipmentKeepTypeDamage: async (id: number) => {
    return await request.delete({ url: `/Damage/equipment-keep-type/delete?id=` + id })
  },

  /** 批量删除设备保养分类 */
  deleteEquipmentKeepTypeListDamage: async (ids: number[]) => {
    return await request.delete({
      url: `/Damage/equipment-keep-type/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出设备保养分类 Excel
  exportEquipmentKeepTypeDamage: async (params) => {
    return await request.download({ url: `/Damage/equipment-keep-type/export-excel`, params })
  },

  // 下载导入模板
  importTemplateDamage: async () => {
    return request.download({ url: '/Damage/equipment-keep-type/get-import-template' })
  }
}
